﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Ue.Framework.Data;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.Adver;

namespace Ue.Qcdz.Repositories.Adver
{
    internal class AdvertisementFactory : IEntityFactory<Advertisement>
    {
        internal class FiledNames : FieldNamesBase
        {
            public const string WebSiteName = "WebSiteName";
            public const string DivId = "DivId";
            public const string AdType = "AdType";
            public const string AdSize = "AdSize";
            public const string AdUrl = "adUrl";
            public const string AdLink = "AdLink";
            public const string PageName = "PageName";
            public const string Remark = "Remark";
        }
        #region IEntityFactory
        public Advertisement BuildEntity(IDataReader reader)
        {
            return new Advertisement(
                reader.Get<string>(FiledNames.WebSiteName),
                reader.Get<string>(FiledNames.DivId),
                reader.Get<string>(FiledNames.AdType),
                reader.Get<string>(FiledNames.AdSize),
                reader.Get<string>(FiledNames.AdUrl),
                reader.Get<string>(FiledNames.AdLink),
                reader.Get<string>(FiledNames.PageName),
                 reader.Get<string>(FiledNames.Remark),
                reader.Get<Guid>(FiledNames.EntityKey)
               
                
                );
        } 
        #endregion
    }
}
